home *** CD-ROM | disk | FTP | other *** search
/ Basic Instinct 2 Press Kit / Basic Instinct 2 Press Kit.iso / pc / main.dxr / FlashPaper_1_BIProdNotes.swf / scripts / __Packages / FPUI / Component.as < prev    next >
Encoding:
Text File  |  2006-03-15  |  3.7 KB  |  140 lines

  1. class FPUI.Component extends MovieClip
  2. {
  3.    var controller;
  4.    static var focusedComponent = null;
  5.    var m_width = 0;
  6.    var m_height = 0;
  7.    var m_enable = true;
  8.    var m_focused = false;
  9.    var m_handlerObj = null;
  10.    var m_changeHandler = "";
  11.    var m_methodTable = null;
  12.    var m_keyListener = null;
  13.    var m_eatsNavKeysWhenFocused = false;
  14.    static var kHiliteColor = 4290117529;
  15.    static var kRolloverColor = 4292542412;
  16.    static var kWhiteBgColor = 4294967295;
  17.    function Component()
  18.    {
  19.       var _loc1_ = this;
  20.       var _loc2_ = _global;
  21.       super();
  22.       _loc1_.useHandCursor = false;
  23.       _loc1_.tabChildren = false;
  24.       _loc1_.tabEnabled = true;
  25.       _loc1_.focusEnabled = true;
  26.       _loc1_._focusrect = false;
  27.       _loc1_._accImpl = new Object();
  28.       _loc1_._accImpl.stub = true;
  29.       _loc1_.m_width = _loc1_._width;
  30.       _loc1_.m_height = _loc1_._height;
  31.       _loc1_.m_methodTable = new Object();
  32.       _loc1_.m_keyListener = new Object();
  33.       _loc1_.m_keyListener.controller = _loc1_;
  34.       _loc1_.m_keyListener.onKeyDown = function()
  35.       {
  36.          this.controller.onComponentKeyDown();
  37.       };
  38.       if(_loc2_.fpuiFocusControl == undefined)
  39.       {
  40.          _loc2_.fpuiFocusControl = new Object();
  41.          _loc2_.fpuiFocusControl.onSetFocus = function(oldFocus, newFocus)
  42.          {
  43.             oldFocus.onComponentKillFocus();
  44.             newFocus.onComponentSetFocus();
  45.             FPUI.Component.focusedComponent = newFocus;
  46.          };
  47.          Selection.addListener(_loc2_.fpuiFocusControl);
  48.       }
  49.    }
  50.    function setEnabled(enabledFlag)
  51.    {
  52.       var _loc1_ = this;
  53.       var _loc2_ = enabledFlag;
  54.       _loc1_.m_enable = _loc2_;
  55.       _loc1_.tabEnabled = _loc2_;
  56.       _loc1_.focusEnabled = _loc2_;
  57.       if(!_loc1_.m_enable && _loc1_.m_focused)
  58.       {
  59.          Selection.setFocus(undefined);
  60.       }
  61.    }
  62.    function getEnabled()
  63.    {
  64.       return this.m_enable;
  65.    }
  66.    function getFocused()
  67.    {
  68.       return this.m_focused;
  69.    }
  70.    function setSize(w, h)
  71.    {
  72.       this.m_width = w;
  73.       this.m_height = h;
  74.    }
  75.    function setChangeHandler(chng, obj)
  76.    {
  77.       var _loc1_ = this;
  78.       _loc1_.m_handlerObj = obj != undefined ? obj : _loc1_._parent;
  79.       _loc1_.m_changeHandler = chng;
  80.    }
  81.    function invalidate(methodName)
  82.    {
  83.       var _loc1_ = this;
  84.       _loc1_.m_methodTable[methodName] = true;
  85.       _loc1_.onEnterFrame = _loc1_.cleanUI;
  86.    }
  87.    function cleanUI()
  88.    {
  89.       var _loc1_ = this;
  90.       var _loc2_ = _loc1_.m_methodTable;
  91.       _loc1_.m_methodTable = new Object();
  92.       delete _loc1_.onEnterFrame;
  93.       for(var _loc3_ in _loc2_)
  94.       {
  95.          _loc1_[_loc3_]();
  96.       }
  97.    }
  98.    function pressFocus()
  99.    {
  100.       Selection.setFocus(this);
  101.    }
  102.    function onComponentSetFocus()
  103.    {
  104.       this.m_focused = true;
  105.       Key.addListener(this.m_keyListener);
  106.    }
  107.    function onComponentKillFocus()
  108.    {
  109.       this.m_focused = false;
  110.       Key.removeListener(this.m_keyListener);
  111.    }
  112.    function onComponentKeyDown()
  113.    {
  114.    }
  115.    function executeCallBack()
  116.    {
  117.       var _loc1_ = this;
  118.       _loc1_.m_handlerObj[_loc1_.m_changeHandler](_loc1_);
  119.    }
  120.    static function fillRect(mc, left, top, width, height, ca)
  121.    {
  122.       var _loc1_ = mc;
  123.       var _loc3_ = top;
  124.       var _loc2_ = ca >> 24;
  125.       if(_loc2_ < 0)
  126.       {
  127.          _loc2_ += 256;
  128.       }
  129.       _loc2_ = _loc2_ * 100 / 255;
  130.       var c = ca & 0xFFFFFF;
  131.       _loc1_.beginFill(c,_loc2_);
  132.       _loc1_.moveTo(left,_loc3_);
  133.       _loc1_.lineTo(left + width,_loc3_);
  134.       _loc1_.lineTo(left + width,_loc3_ + height);
  135.       _loc1_.lineTo(left,_loc3_ + height);
  136.       _loc1_.lineTo(left,_loc3_);
  137.       _loc1_.endFill();
  138.    }
  139. }
  140.